import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/personal',
    name: 'Personal',
    component: () => import('../views/personal'),
    meta: {
      needAuth: true
    }
  },
  {
    path: '/edit',
    name: 'Edit',
    component: () => import('../views/personal/edit.vue'),
    meta: {
      needAuth: true
    }
  },
  {
    path: '/follows',
    name: 'Follows',
    component: () => import('../views/personal/follows.vue'),
    meta: {
      needAuth: true
    }
  },
  {
    path: '/star',
    name: 'Star',
    component: () => import('../views/personal/star.vue'),
    meta: {
      needAuth: true
    }
  },
  {
    path: '/category',
    name: 'Category',
    component: () => import('../views/personal/category.vue'),
    meta: {
      needAuth: true
    }
  },
  {
    path: '/detail',
    name: 'Detail',
    component: () => import('../views/Detail.vue'),
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('../views/Search.vue'),
  }
]

const router = new VueRouter({
  routes
})

export default router
